home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / C Libraries / MathTools.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-04  |  554 b   |  24 lines  |  [TEXT/KAHL]

  1. #include <MathTools.h>
  2.  
  3. /*------------------------------------------------------------------------------*/
  4.  
  5.     int ReturnEven (int TheInt)
  6.     /* Given an integer, return 1 + TheInt if it is odd, or TheInt if it is even */
  7.     {
  8.         return (TheInt % 2) ? TheInt+1 : TheInt;
  9.     }
  10.     
  11. /*------------------------------------------------------------------------------*/
  12.  
  13.     Boolean odd (long theval)
  14.     {
  15.         return (theval % 2);
  16.     }
  17.  
  18. /*------------------------------------------------------------------------------*/
  19.  
  20.     Boolean even (long theval)
  21.     {
  22.         return (!(theval % 2));
  23.     }
  24.